USE [OHNEW]
GO

/****** Object:  Table [dbo].[P_Material]    Script Date: 01/23/2013 14:21:08 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[P_Material](
	[ID] [uniqueidentifier] NOT NULL,
	[Code] [varchar](50) NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[MaterialGroup] [uniqueidentifier] NOT NULL,
	[Origin] [dbo].[udtNAME] NOT NULL,
	[Measure] [uniqueidentifier] NOT NULL,
	[Package] [uniqueidentifier] NOT NULL,
	[CostPrice] [dbo].[udtJE] NOT NULL,
	[RefPrice] [dbo].[udtJE] NOT NULL,
	[MaxStocks] [dbo].[udtSL] NOT NULL,
	[MinStocks] [dbo].[udtSL] NOT NULL,
	[StockBalance] [dbo].[udtSL] NOT NULL,
	[Disable] [int] NOT NULL,
	[Duration] [int] NOT NULL,
	[HazardRating] [int] NOT NULL,
 CONSTRAINT [PK_P_Material] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[P_Material] ADD  CONSTRAINT [DF__P_Material__ID__793DFFAF]  DEFAULT (newid()) FOR [ID]
GO

ALTER TABLE [dbo].[P_Material] ADD  DEFAULT ('') FOR [Origin]
GO

ALTER TABLE [dbo].[P_Material] ADD  DEFAULT ((0)) FOR [CostPrice]
GO

ALTER TABLE [dbo].[P_Material] ADD  DEFAULT ((0)) FOR [RefPrice]
GO

ALTER TABLE [dbo].[P_Material] ADD  DEFAULT ((0)) FOR [MaxStocks]
GO

ALTER TABLE [dbo].[P_Material] ADD  DEFAULT ((0)) FOR [MinStocks]
GO

ALTER TABLE [dbo].[P_Material] ADD  CONSTRAINT [DF_P_Material_Disable]  DEFAULT ((0)) FOR [Disable]
GO

ALTER TABLE [dbo].[P_Material] ADD  DEFAULT ((0)) FOR [Duration]
GO

ALTER TABLE [dbo].[P_Material] ADD  DEFAULT ((0)) FOR [HazardRating]
GO


